package com.alibaba.citrus.cr.sales.plan.converter;

import com.alibaba.citrus.cr.sales.plan.dto.api.request.FlowInstanceStartUpRequest;
import com.alibaba.citrus.cr.sales.plan.dto.api.request.TaskSubmitRequest;
import com.alibaba.citrus.cr.sales.plan.dto.api.response.FlowInstanceStartUpResponse;

import com.epoch.app.bcorder.model.dto.SalesPlanSubmitTaskRequest;
import com.epoch.app.bcorder.model.dto.StartUpAuditFlowInstanceRequest;
import com.epoch.app.bcorder.model.dto.StartUpAuditFlowInstanceResponse;

/**
 * @author:suqing.tjf
 * @date:2021/10/14
 */
public class MeshAuditFlowRepositoryConverter {

    public static StartUpAuditFlowInstanceRequest convertStartUpAuditFlowInstanceRequest(
        FlowInstanceStartUpRequest source) {
        if (null == source) {
            return null;
        }
        StartUpAuditFlowInstanceRequest target = StartUpAuditFlowInstanceRequest.builder().build();
        target.setAppCode(source.getAppCode());
        target.setProcessCode(source.getProcessCode());
        target.setBody(source.getBody());
        return target;
    }

    public static FlowInstanceStartUpResponse convertFlowInstanceStartUpResponse(StartUpAuditFlowInstanceResponse source) {
        if (null == source) {
            return null;
        }
        FlowInstanceStartUpResponse target = new FlowInstanceStartUpResponse();
        target.setCreatorId(source.getCreatorId());
        target.setInstanceId(source.getInstanceId());
        return target;
    }

    public static SalesPlanSubmitTaskRequest convertSalesPlanSubmitTaskRequest(TaskSubmitRequest source) {
        if (null == source) {
            return null;
        }
        SalesPlanSubmitTaskRequest target = SalesPlanSubmitTaskRequest.builder().build();
        target.setTaskId(source.getTaskId());
        target.setBody(source.getBody());
        return target;
    }
}
